//
//  HNSH_AboutUsHeaderView.m
//  HNSH_SingleProject
//
//  Created by 李宇廷 on 2023/2/28.
//

#import "HNSH_AboutUsHeaderView.h"

@interface HNSH_AboutUsHeaderView ()
/**  */
@property (nonatomic, strong)UIImageView * imgView;
/**  */
@property (nonatomic, strong)UILabel * verLabel;
@end

@implementation HNSH_AboutUsHeaderView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self configUI];
    }
    return self;
}

- (void)configUI {
    [self addAllViews];
    [self addAllLayout];
}

//MARK: Myself Methods
- (void)addAllViews{
    [self addSubview:self.imgView];
    [self addSubview:self.verLabel];
}

- (void)addAllLayout{
    [self.imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.top.mas_equalTo(40);
        make.width.mas_equalTo(80);
        make.height.mas_equalTo(80);
    }];
    [self.verLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.top.mas_equalTo(self.imgView.mas_bottom).offset(8);
        make.height.mas_equalTo(22);
    }];
    
    UIView *lineView = [[UIView alloc]init];
    lineView.backgroundColor = [UIColor colorWithHexString:@"#F2F3F6"];
    [self addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(38);
        make.right.mas_equalTo(-38);
        make.bottom.mas_equalTo(0);
        make.height.mas_equalTo(1);
    }];
}

//MARK: Getter Methods
- (UIImageView *)imgView{
    if (!_imgView) {
        _imgView = [UIImageView new];
        _imgView.image = [UIImage imageNamed:@"login_home_center_icon"];
    }
    return _imgView;
}

- (UILabel *)verLabel{
    if (!_verLabel) {
        _verLabel = [UILabel new];
        _verLabel.font = [UIFont boldSystemFontOfSize:16];
        _verLabel.textColor = [UIColor appBlackLabelColor];
        _verLabel.textAlignment = NSTextAlignmentCenter;
        _verLabel.text = [NSString stringWithFormat:@"V%@", [UIApplication sharedApplication].appVersion];
    }
    return _verLabel;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}[NSString stringWithFormat:@"V%@", [UIApplication sharedApplication].appVersion]
*/

@end
